package panda.planner.impl;

import java.util.HashSet;
import java.util.Map;

import panda.query.condition.Clause;
import panda.query.struct.Attribute;
import panda.query.tree.QueryTreeNode;

/**
 * A class that holds the information used in the derivation of dynamic programming
 * @author Tian Yuan
 *
 */
class Element {
	QueryTreeNode node;
	HashSet<Clause> used;
	private int cost = -1;
	
	Element(QueryTreeNode n, HashSet<Clause> used, int c) {
		node = n;
		cost = c;
		this.used = used;
	}
	
	Element(QueryTreeNode n, HashSet<Clause> used) {
		node = n;
		this.used = used;
	}
	
	int getCost() {
		//TODO Adjust this to other features in order to achieve better estimate
		if (cost == -1) return (cost = node.blockAccessed()); else return cost;
	}
}